﻿using System;
using System.Data;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using HiauPdm.Bll;
using HiauPdm.Web;

namespace HiauPdm.Web
{
    public partial class CplbXzLeft : PageBase
    {
        protected override bool IsAccess()
        {
            return true;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LblTitle.Text = "产品设计类别";
                TreeNode tn = new TreeNode("产品设计类别", "0");
                tn.SelectAction = TreeNodeSelectAction.None;
                tn.PopulateOnDemand = true;
                TreeCplb.Nodes.Add(tn);
                TreeCplb.ExpandDepth = 1;
            }
        }

        protected void TreeCplb_TreeNodePopulate(object sender, TreeNodeEventArgs e)
        {
            DataSet dsCplb = BCpSjCx.GetChildCplb(int.Parse(e.Node.Value));
            if ((dsCplb != null) && (dsCplb.Tables[0].Rows.Count > 0))
            {
                foreach (DataRow dr in dsCplb.Tables[0].Rows)
                {
                    TreeNode tn = new TreeNode(string.Format("[{0}]{1}", dr["编号"], dr["类别名称"]), dr["ID"].ToString());
                    tn.ToolTip = tn.Text;
                    if (e.Node.Depth < 1)
                    {
                        tn.SelectAction = TreeNodeSelectAction.Expand;
                        tn.PopulateOnDemand = true;
                    }
                    else
                    {
                        tn.NavigateUrl = "javascript:GotoUrl(" + tn.Value + ");";
                    }
                    e.Node.ChildNodes.Add(tn);
                }
            }
        }
    }
}